package com.aspose.cells;

class zaxg extends zawf {
   private zagu a;
   private zagu b;
   private int c;
   private int[] d;
   private int[] e;
   private boolean f;
   private int g;
   private boolean h;
   private int i;
   private int j;
   private int k;
   private int l;
   private int m;
   private int n;
   private int o;
   private int p;
   private int q;
   private int r;
   private int s;

   public zaxg(zagu var1, zagu var2, int var3, int[] var4, int[] var5, int var6, int var7, boolean var8, int var9, boolean var10) {
      this.a = var1;
      this.b = var2;
      this.c = var3;
      this.d = var4;
      this.e = var5;
      this.j = var6;
      this.i = var9;
      this.h = var10;
      this.g = var7;
      this.f = var8;
      this.C();
   }

   zaxg(zaxg var1) {
      this.a = var1.a;
      this.b = var1.b;
      this.c = var1.c;
      this.d = var1.d;
      this.e = var1.e;
      this.f = var1.f;
      this.g = var1.g;
      this.h = var1.h;
      this.i = var1.i;
      this.j = var1.j;
      this.k = var1.k;
      this.l = var1.l;
      this.m = var1.m;
      this.o = var1.o;
      this.n = var1.n;
      this.p = var1.p;
      this.q = var1.q;
      this.r = var1.r;
      this.s = var1.s;
   }

   public zahn b(zaay var1) {
      return new zaxg(this);
   }

   public int c() {
      return this.f ? this.g : 1;
   }

   public int d() {
      return this.f ? 1 : this.g;
   }

   public int e() {
      return this.g;
   }

   public boolean l() {
      return this.g == 1;
   }

   public boolean m() {
      return !this.f;
   }

   public boolean n() {
      return this.f;
   }

   public int b() {
      return this.c;
   }

   public zagu a(int var1, int var2) {
      if (this.m < 1) {
         return this.a;
      } else {
         int var3 = (this.f ? var1 : var2) + this.j;
         int var4 = com.aspose.cells.b.a.za.a(this.d, this.k, this.m, var3);
         if (var4 < 0) {
            if (var4 == -1) {
               return this.a;
            }

            var4 = -var4 - 2;
            if (this.e[var4] <= var3) {
               return this.a;
            }
         }

         return this.b;
      }
   }

   public void f() {
      this.p = this.k;
      if (this.m < 1) {
         this.q = this.g;
      } else {
         this.r = this.o;
         if (this.k < this.l) {
            this.s = this.e[this.p] - this.j;
         } else {
            this.s = this.n;
         }

         this.q = this.o - 1;
      }
   }

   public boolean b(int var1, int var2) {
      return this.a(this.f ? var1 : var2);
   }

   public boolean a(int var1) {
      if (this.m < 1) {
         return false;
      } else if (var1 == this.q) {
         return true;
      } else if (this.p <= this.l) {
         if (var1 < this.s) {
            if (var1 < this.r) {
               this.p = com.aspose.cells.b.a.za.a(this.d, this.k, this.p - this.k, var1 + this.j);
               if (this.p < 0) {
                  if (this.p == -1) {
                     this.p = 0;
                     this.r = this.o;
                     this.s = this.e[this.p] - this.j;
                     this.q = this.r;
                  } else {
                     this.p = -this.p - 2;
                     this.s = this.e[this.p] - this.j;
                     if (this.s <= var1) {
                        ++this.p;
                        this.r = this.d[this.p] - this.j;
                        this.s = this.e[this.p] - this.j;
                        this.q = this.r;
                     } else {
                        this.r = this.d[this.p] - this.j;
                        this.q = var1;
                     }
                  }
               } else {
                  this.r = this.d[this.p] - this.j;
                  this.s = this.e[this.p] - this.j;
                  this.q = var1;
               }
            } else {
               this.q = var1;
            }

            return true;
         } else if (var1 == this.s) {
            ++this.p;
            if (this.p < this.l) {
               this.s = this.e[this.p] - this.j;
            } else {
               if (this.p > this.l) {
                  this.q = -1;
                  return false;
               }

               this.s = this.n;
            }

            this.r = this.d[this.p] - this.j;
            this.q = this.r;
            return true;
         } else {
            ++this.p;
            if (this.p <= this.l) {
               this.p = com.aspose.cells.b.a.za.a(this.d, this.p, this.l - this.p + 1, var1 + this.j);
               if (this.p < 0) {
                  this.p = -this.p - 2;
                  this.s = this.e[this.p] - this.j;
                  if (this.s <= var1) {
                     ++this.p;
                     if (this.p < this.l) {
                        this.s = this.e[this.p] - this.j;
                     } else {
                        if (this.p > this.l) {
                           this.q = -1;
                           return false;
                        }

                        this.s = this.n;
                     }

                     this.r = this.d[this.p] - this.j;
                     this.q = this.r;
                  } else {
                     this.r = this.d[this.p] - this.j;
                     this.q = var1;
                  }
               } else {
                  if (this.p < this.l) {
                     this.s = this.e[this.p] - this.j;
                  } else {
                     this.s = this.n;
                  }

                  this.r = this.d[this.p] - this.j;
                  this.q = var1;
               }

               return true;
            } else {
               this.q = -1;
               return false;
            }
         }
      } else {
         this.p = com.aspose.cells.b.a.za.a(this.d, this.k, this.m, var1 + this.j);
         if (this.p < 0) {
            if (this.p == -1) {
               this.p = 0;
               this.r = this.o;
               this.s = this.e[this.p] - this.j;
               this.q = this.r;
            } else {
               this.p = -this.p - 2;
               this.s = this.e[this.p] - this.j;
               if (this.s <= var1) {
                  ++this.p;
                  if (this.p < this.l) {
                     this.s = this.e[this.p] - this.j;
                  } else {
                     if (this.p > this.l) {
                        this.q = -1;
                        return false;
                     }

                     this.s = this.n;
                  }

                  this.r = this.d[this.p] - this.j;
                  this.q = this.r;
               } else {
                  this.r = this.d[this.p] - this.j;
                  this.q = var1;
               }
            }
         } else {
            if (this.p < this.l) {
               this.s = this.e[this.p] - this.j;
            } else {
               this.s = this.n;
            }

            this.r = this.d[this.p] - this.j;
            this.q = var1;
         }

         return true;
      }
   }

   public boolean g() {
      ++this.q;
      if (this.q < this.s) {
         return true;
      } else {
         ++this.p;
         if (this.p < this.l) {
            this.s = this.e[this.p] - this.j;
         } else {
            if (this.p != this.l) {
               this.q = this.g;
               return false;
            }

            this.s = this.n;
         }

         this.q = this.d[this.p] - this.j;
         return true;
      }
   }

   public zagu h() {
      return this.b;
   }

   public int i() {
      return this.f ? this.q : 0;
   }

   public int j() {
      return this.f ? 0 : this.q;
   }

   public int k() {
      return this.q;
   }

   public zahn b(int var1) {
      return (zahn)(this.f ? new zaya(this.a(var1, 0)) : this);
   }

   public zahn c(int var1) {
      return (zahn)(this.f ? this : new zaya(this.a(0, var1)));
   }

   public zagu o() {
      return this.g == 1 && this.m > 0 ? this.b : this.a;
   }

   public zagu p() {
      return this.g == 1 && this.m > 0 ? this.b : this.a;
   }

   public boolean x() {
      return this.h && this.f;
   }

   public boolean y() {
      return this.h && !this.f;
   }

   public void a(zaay var1) {
      if (this.h) {
         if (this.f) {
            if (var1.g == this.i) {
               return;
            }

            this.j += this.i - var1.g;
            this.i = var1.g;
         } else {
            if (var1.h == this.i) {
               return;
            }

            this.j += this.i - var1.h;
            this.i = var1.h;
         }

         this.C();
      }
   }

   private void C() {
      this.k = com.aspose.cells.b.a.za.a((int[])this.d, 0, this.d.length, (int)this.j);
      if (this.k < 0) {
         if (this.k == -1) {
            this.k = 0;
         } else {
            this.k = -this.k - 2;
            if (this.e[this.k] <= this.j) {
               ++this.k;
            }
         }
      }

      this.l = com.aspose.cells.b.a.za.a(this.d, this.k, this.d.length, this.j + this.g);
      if (this.l < 0) {
         this.l = -this.l - 2;
      } else {
         --this.l;
      }

      if (this.k <= this.l) {
         this.m = this.l - this.k + 1;
         this.o = Math.max(this.d[this.k] - this.j, 0);
         this.n = Math.min(this.g, this.e[this.l] - this.j);
      } else {
         this.m = 0;
      }

   }

   public boolean q() {
      return true;
   }

   public int r() {
      return this.m > 0 ? (this.f ? this.o : 0) : -1;
   }

   public int s() {
      return this.m > 0 ? (this.f ? this.n : 0) : -1;
   }

   public int t() {
      return this.m > 0 ? (this.f ? 0 : this.o) : -1;
   }

   public int u() {
      return this.m > 0 ? (this.f ? 0 : this.n) : -1;
   }

   public int v() {
      return this.m > 0 ? this.o : -1;
   }

   public int w() {
      return this.m > 0 ? this.n : -1;
   }
}
